/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * panelInicio.java
 *
 * Created on Apr 15, 2011, 9:14:55 PM
 */

package frontera.interfaz.panel;

import control.SIRHApp;
import frontera.interfaz.dialogo.DialogCambiarContrasenia;
import java.awt.GridBagConstraints;
import java.awt.GridLayout;
import java.util.ArrayList;
import javax.swing.Action;
/**
 *
 * @author Nico
 */
public class PanelInicio extends javax.swing.JPanel {

    /** Creates new form panelInicio */
    public PanelInicio() {
        initComponents();
        labelNombreEmpleado3.setText(SIRHApp.getInstance().getAdmPermisos().getUsuario().getEmpleadoAsociado().getNombre());
        ArrayList<Action> acciones = SIRHApp.getInstance().getAdmPermisos().getAccionesInicio();
        panelOpciones3.setLayout(new GridLayout((int) Math.ceil(acciones.size()/3), (acciones.size()>3)?3:acciones.size()%3));
        for (Action a : acciones){
            panelOpciones3.add(new PanelOpcionInicio(a));
        }
        jPanel3.add(panelOpciones3,new GridBagConstraints());
        jPanel10.add(jPanel8,new GridBagConstraints());

    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel8 = new javax.swing.JPanel();
        jLabel5 = new javax.swing.JLabel();
        labelNombreEmpleado3 = new javax.swing.JLabel();
        panelOpciones3 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        ConfigurarAppBT = new javax.swing.JButton();
        jPanel3 = new javax.swing.JPanel();
        jPanel10 = new javax.swing.JPanel();

        jLabel5.setFont(new java.awt.Font("Tahoma", 1, 24));
        jLabel5.setText("Bienvenido");

        labelNombreEmpleado3.setFont(new java.awt.Font("Tahoma", 1, 24));
        labelNombreEmpleado3.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        labelNombreEmpleado3.setText("[Nombre Empleado]");

        javax.swing.GroupLayout jPanel8Layout = new javax.swing.GroupLayout(jPanel8);
        jPanel8.setLayout(jPanel8Layout);
        jPanel8Layout.setHorizontalGroup(
            jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel8Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel5)
                .addGap(18, 18, 18)
                .addComponent(labelNombreEmpleado3, javax.swing.GroupLayout.DEFAULT_SIZE, 271, Short.MAX_VALUE)
                .addContainerGap())
        );
        jPanel8Layout.setVerticalGroup(
            jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel8Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel5)
                    .addComponent(labelNombreEmpleado3))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout panelOpciones3Layout = new javax.swing.GroupLayout(panelOpciones3);
        panelOpciones3.setLayout(panelOpciones3Layout);
        panelOpciones3Layout.setHorizontalGroup(
            panelOpciones3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 0, Short.MAX_VALUE)
        );
        panelOpciones3Layout.setVerticalGroup(
            panelOpciones3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 0, Short.MAX_VALUE)
        );

        jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/frontera/recursos/logo_Transparente.png"))); // NOI18N

        ConfigurarAppBT.setIcon(new javax.swing.ImageIcon(getClass().getResource("/frontera/recursos/1302920576_Service Manager.png"))); // NOI18N
        ConfigurarAppBT.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                ConfigurarAppBTActionPerformed(evt);
            }
        });

        jPanel3.setLayout(new java.awt.GridBagLayout());

        jPanel10.setLayout(new java.awt.GridBagLayout());

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jPanel3, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 676, Short.MAX_VALUE)
                    .addComponent(jPanel10, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 676, Short.MAX_VALUE)
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
                        .addComponent(jLabel1)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 358, Short.MAX_VALUE)
                        .addComponent(ConfigurarAppBT, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel1)
                    .addGroup(layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(ConfigurarAppBT)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel10, javax.swing.GroupLayout.PREFERRED_SIZE, 37, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, 336, Short.MAX_VALUE)
                .addContainerGap())
        );
    }// </editor-fold>//GEN-END:initComponents

    private void ConfigurarAppBTActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ConfigurarAppBTActionPerformed
       DialogCambiarContrasenia cambiar = new  DialogCambiarContrasenia(null, true);
       cambiar.setLocationRelativeTo(this);
       cambiar.setVisible(true);
}//GEN-LAST:event_ConfigurarAppBTActionPerformed


    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton ConfigurarAppBT;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JPanel jPanel10;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel8;
    private javax.swing.JLabel labelNombreEmpleado3;
    private javax.swing.JPanel panelOpciones3;
    // End of variables declaration//GEN-END:variables

}
